package com.itany.thread.test01;

public class ThreadA implements Runnable{
	private Object obj1;
	private Object obj2;
	public ThreadA(Object obj1,Object obj2) {
		this.obj1 = obj1;
		this.obj2 = obj2;
	}	
	@Override
	public void run() {
		synchronized (obj1) {
			System.out.println("ThreadA get obj1 wait obj2");
			try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			synchronized (obj2) {
				System.out.println("ThreadA get obj2");
			}
		}
	}
}
